<?php
    require_once 'public/includes/functions.php';
    require_once 'models/container.php';
    
    class PageController extends functions {
        
        var $container =null;        
        
        function __construct(){
            $this->container = new Container_Model();            
        }
        
        /**
         * Xem chi tiet bai viet
         * @return STring
         **/
        function ViewContent(){
            
            $list = null;
            if(empty($currentPage)|| $currentPage==1) $currentPage = 0; 
            if(isset($_GET['id'])){
                $id = $_GET['id'];
                $res = $this->container->ExecuteSQL("select * from container WHERE ID = {$id}");                                    
                $rs = mysql_fetch_array($res);
            	$name=$rs['name'];
            	$gioithieu = $rs['gioithieu'];
            	$noidung = $rs['noidung'];
            	
            	$sdt = $rs['sdt'];
            	$anh = $rs['anh'];
            	$nguon = $rs['nguon'];									
            	$cat_id= $rs['cat_id'];
            	$ngaypost=$rs['ngaypost'];
            	$k=$rs['kinhdo'];
            	$v=$rs['vido'];
            	$diadiem=$rs['diadiem'];
                $list  ='<div class=" noidungchitiet nd">
                        	<img src="upload/images/'.$anh.'" border="1" class="hinhbaiviet" width="178" height="185"/>
                            <img src="public/images/logobaiviet.png" class="logobaiviet"/> 
                            <h3 class="tieude">'.$name.'</h3>
                            <br/>
                        	<h5>Posted at:'.$ngaypost.'</h5>
                        	<div id="p">
                            	<p class="content">';
                //doc file hmtl;
                $ndFile = file('upload/files/'.$noidung);
                //chuyen mang sang chuoi
                $list.=   implode($ndFile, ' ');
                // $list .=              include 'upload/files/'.$noidung ;
                $list .=       '</p>
                            	<p class="ps">'.$nguon.'</p>
                            	<p class="map">
                            		<a href="./?rt=map&fn=onemark&id='.$id.'">Xem bản đồ</a>
                            	</p>
                            </div>
                    	</div>';
            	
            //
            // == XEM THONG TIN TOUR DU LICH
            }else if(isset($_GET['idtour'])){
                $id = $_GET['idtour'];
                $res = $this->container->ExecuteSQL("select * from tour_dulich WHERE id_tour = {$id}");                                    
                $rs = mysql_fetch_array($res);
                
            	$name=$rs['ten_tour'];
            	$gioithieu = $rs['gioithieu'];
            	$noidi = $rs['noidi'];
                $noiden = $rs['noiden'];
                $account = $rs['ma_taikhoan'];                
            	$anh = "upload/images/".$rs['hinhminhhoa'];
           		
                $list  ='<div class=" noidungchitiet">
                            <h4 style="font-size: 1.4em; text-indent: 30px; font-weight: bold; color: blue;">'.$name.'</h4>
                        	<img style="float: none !important;" src="'.$anh.'" border="1"  width="178" height="185"/>
                            
                            <p class="ps">'.$gioithieu.'</p>
                            
                            <p>Nơi đi: <span>'.$noidi .'</span></p>
                            <p>Nơi đến: <span>'.$noiden .'</span></p>
                            <p>Mã tài khoản công ty: <span>'.$account .'</span></p>
                            
                    	</div>';
            }            
            return $list;
        }
        
        public function indexAtion(){
            
        }
    }
    
    // thuc thi class
    $page = new PageController();
    $page->show('page');
?>